package com.kdl.webconfig.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kdl.webconfig.entity.ButtonConfig;
import com.kdl.webconfig.mapper.ButtonConfigMapper;
import com.kdl.webconfig.service.IButtonConfigService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 按钮配置表 服务实现类
 * </p>
 *
 * @author wcj
 * @since 2022-09-05
 */
@Service
public class ButtonConfigServiceImpl extends ServiceImpl<ButtonConfigMapper, ButtonConfig> implements IButtonConfigService {

    @Resource
    private ButtonConfigMapper buttonConfigMapper;

    @Override
    public void deleteByPicId(Integer id) {
        QueryWrapper<ButtonConfig> buttonConfigQueryWrapper = new QueryWrapper<>();
        buttonConfigQueryWrapper.lambda().eq(ButtonConfig::getPicId,id);
        buttonConfigMapper.delete(buttonConfigQueryWrapper);
    }

    @Override
    public List<ButtonConfig> selectByPicId(Integer picId) {
        QueryWrapper<ButtonConfig> buttonConfigQueryWrapper = new QueryWrapper<>();
        buttonConfigQueryWrapper.lambda().eq(ButtonConfig::getPicId,picId);
        return buttonConfigMapper.selectList(buttonConfigQueryWrapper);
    }
}
